package com.dfrz.ch06.task;

import java.util.Scanner;

/**
 * 作者：wangmaokang
 * 日期: 2021/4/13 14:16
 * 描述: 打印等腰三角形
 */
public class PyramidTest5 {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        System.out.println("请输入你要创建的三角形层数");
        int i=scanner.nextInt();
        for (int j=1;j<=i;j++){   //行数
            for (int o=1;o<=i-j;o++){
                System.out.print(" ");
            }
            for (int z=1;z<=(2*j-1);z++){

                    System.out.print("*");
            }
            System.out.println("");
        }

        for (int j=i-1;j>=0;j--){   //行数
            for (int o=1;o<=i-j;o++){
                System.out.print(" ");
            }
            for (int z=1;z<=(2*j-1);z++){

                    System.out.print("*");

            }
            System.out.println("");
        }


    }
}
